﻿<%@ Page Title="Users" Language="C#" MasterPageFile="~/TableMaster.master" AutoEventWireup="true" CodeFile="Users.aspx.cs" Inherits="admin_Users" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style>
        @media only screen and (max-width: 760px), (min-device-width: 768px) and (max-device-width: 1024px) {

            .resTbl tr:nth-of-type(odd) {
                background-color: #CDE2FF;
            }

            .resTbl tr:nth-of-type(1) {
                display: none;
            }

            .resTbl td:nth-of-type(1):before {
                content: "User Code";
            }

            .resTbl td:nth-of-type(2):before {
                content: "User Name";
            }

            .resTbl td:nth-of-type(3):before {
                content: "User Password";
            }

            .resTbl td:nth-of-type(4):before {
                content: "User Type";
            }

            .resTbl td:nth-of-type(5):before {
                content: "Is Active";
            }

            .resTbl td:nth-of-type(6):before {
                content: "Created By";
            }

            .resTbl td:nth-of-type(7):before {
                content: "Created Date";
            }
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Add" runat="Server">


    <asp:Panel ID="pnlAdd" runat="server">

        <table cellpadding="0" cellspacing="0" style="width: 100%;">

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblUSER_CODE" runat="server" AssociatedControlID="txtUSER_CODE" Text="User Code:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtUSER_CODE" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblUSER_NAME" runat="server" AssociatedControlID="txtUSER_NAME" Text="User Name:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtUSER_NAME" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblUSER_PASSWORD" runat="server" AssociatedControlID="txtUSER_PASSWORD" Text="User Password:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtUSER_PASSWORD" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblUSER_TYPE_ID" runat="server" AssociatedControlID="ddlUSER_TYPE_ID" Text="User Type Id:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlUSER_TYPE_ID" runat="server" DataSourceID="DS_UserTypes" DataTextField="USER_TYPE" DataValueField="USER_TYPE_ID" AppendDataBoundItems="True" EnableViewState="False">
                        <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_UserTypes" runat="server" SelectMethod="selectAll" TypeName="DAL_tbl_user_type"></asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblIS_ACTIVE" runat="server" AssociatedControlID="chkIS_ACTIVE" Text="Is Active:"></asp:Label>
                </td>
                <td>
                    <asp:CheckBox ID="chkIS_ACTIVE" runat="server"></asp:CheckBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">&nbsp;</td>
                <td>

                    <asp:Button ID="btnSave" runat="server" CssClass="btn btn-success" OnClick="btnSave_Click" Text="Save" Width="90px" />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnCancel" runat="server" CssClass="btn btn-danger" OnClick="btnCancel_Click" Text="Cancel" Width="90px" />

                </td>
            </tr>

        </table>

    </asp:Panel>

</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Grid" runat="Server">
    <asp:Panel ID="pnlList" runat="server">
        <asp:GridView ID="gridClients" runat="server" AutoGenerateColumns="False" CssClass="resTbl" DataSourceID="DS_tbl_users">
            <Columns>
                <asp:BoundField DataField="USER_CODE" HeaderText="User Code" SortExpression="USER_CODE" />
                <asp:BoundField DataField="USER_NAME" HeaderText="User Name" SortExpression="USER_NAME" />
                <asp:BoundField DataField="USER_PASSWORD" HeaderText="User Password" SortExpression="USER_PASSWORD" />
                <asp:BoundField DataField="USER_TYPE_ID" HeaderText="User Type" SortExpression="USER_TYPE_ID" />
                <asp:BoundField DataField="IS_ACTIVE" HeaderText="Is Active" SortExpression="IS_ACTIVE" />
                <asp:BoundField DataField="CREATED_BY" HeaderText="Created By" SortExpression="CREATED_BY" />
                <asp:BoundField DataField="CREATED_DATE" HeaderText="Created Date" SortExpression="CREATED_DATE" DataFormatString="{0:yyMMdd}" />

                <asp:TemplateField HeaderText="Edit">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkEdit" runat="server" Text="Edit" CommandArgument='<%# Eval("USER_CODE") %>' OnClick="linkEdit_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Delete">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkDelete" CommandName="delete" runat="server" Text="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this record?');" CommandArgument='<%# Eval("USER_CODE") %>' OnClick="linkDelete_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="DS_tbl_users" runat="server" SelectMethod="selectAllForGrid" DeleteMethod="delete" InsertMethod="insert" UpdateMethod="update" TypeName="DAL_tbl_users">
            <DeleteParameters>
                <asp:Parameter Name="USER_CODE" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="USER_CODE" Type="Int32" />
                <asp:Parameter Name="USER_NAME" Type="String" />
                <asp:Parameter Name="USER_PASSWORD" Type="String" />
                <asp:Parameter Name="USER_TYPE_ID" Type="Int32" />
                <asp:Parameter Name="IS_ACTIVE" Type="Boolean" />
                <asp:Parameter Name="CREATED_BY" Type="String" />
                <asp:Parameter Name="CREATED_DATE" Type="DateTime" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="USER_CODE" Type="Int32" />
                <asp:Parameter Name="USER_NAME" Type="String" />
                <asp:Parameter Name="USER_PASSWORD" Type="String" />
                <asp:Parameter Name="USER_TYPE_ID" Type="Int32" />
                <asp:Parameter Name="IS_ACTIVE" Type="Boolean" />
                <asp:Parameter Name="UPDATED_BY" Type="String" />
                <asp:Parameter Name="UPDATED_DATE" Type="DateTime" />
            </UpdateParameters>
        </asp:ObjectDataSource>
    </asp:Panel>
</asp:Content>

